<?php

if (!defined('BASEPATH'))
    exit('No direct script access allowed');

class Dompdf1 extends MN_Controller {

    function __construct() {
        parent::__construct();
        $this->load->database();
        $this->load->helper(array('url', 'form'));
        $this->load->library('ion_auth');
        $this->load->library('session');
        $this->load->model('Carrera_Model');
    }

    public function index() {

        if (!$this->ion_auth->logged_in()) {
            //redirect them to the login page
            redirect('auth/login', 'refresh');
        } elseif (!$this->ion_auth->is_admin()) {
            //redirect them to the home page because they must be an administrator to view this
            $this->_render('home/inicio');
        } else {
            //set the flash data error message if there is one
            $this->_render('home/inicio');
        }
    }

    public function inicio() {


        $this->data['carrera'] = $this->Carrera_Model->getListado();
        $html = $this->load->view('reportes/carreras', $this->data, true);


        //$this->load->view('header', $this->data, true);
        //$html=$this->load->view('dompdf/index',$this->data, true);
        // $this->load->view('footer');

        $html = "<html><head></head><body>" . $html . " </body></html>";
        //call the function createPDF
        //echo ("$html");
        $this->dompdf_lib->createPDF($html, 'myfilename');
    }

}

/* End of file welcome.php */
    /* Location: ./application/controllers/welcome.php */


    